<template>
  <el-button v-if="isShow" :type="type">{{ text }}</el-button>
</template>

<script>
export default {
  props: {
    text: {
      type: String,
      default: '操作'
    },
    type: {
      type: String,
      default: 'primary'
    }
  },
  computed: {
    isShow() {
      const path = this.$route.path
      const roleid = this.$store.state.user.role
      return this.$store.state.user.nodes.find(({ route, role }) => route === path && role == roleid)
    }
  }
}
</script>

<style lang="scss" scoped></style>
